<?PHP
$PurviewLevel=0;
require("../../inc/common.inc.php");
require_once(dirname(__FILE__)."/../"."Admin_ChkPurview.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<TITLE>铭讯EOS网站后台管理</TITLE>
<Meta name="Keywords" Content="济南网站建设 济南网站制作 山东网站建设 济南铭讯软件有限公司">
<Meta name="Description" Content="济南网站制作：铭讯软件专业服务优秀企业，致力于网站建、设网站推广、网络营销一体的全访位网络服务商">
<link href="../images/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php require("../mx_head.php");?>
<?php
/**
*处理添加新消息
**/
if($action=="saveeidt"){

if ($fname=="" || empty($fname)){
	$fun->popmassage("请填写标题","","popback");
	exit();
}

$truepath=preg_replace("/(.+)\/([^\/]+)\/([^\/]+)/is","\\1",'http://'.$HTTP_HOST.$PHP_SELF);
$edittime = mktime();
if($mabstract=="" || empty($mabstract)){$mabstract = DeleteHtml($mcontent);}
		
$db->excu("update`mx_sucai_file` set `fname`='$fname',`fintro`='$fintro',`fpic`='$fpic', `edittime`='$edittime',editid='".$_SESSION['mxadmin']['userid']."' where fid=$id");

jump2("操作成功",$phpfile,2);
exit();
}
	$rsdb=$db->get_one("SELECT * FROM mx_sucai_file WHERE fid='$id' LIMIT 1");
    if ($rsdb=="" || empty($rsdb)){
	  $fun->popmassage("非法访问，系统将自动返回上一页！","","popback");
	  exit();
	}
	//获得封面图片
	$ftype = $rsdb["ftype"];
	switch($ftype){
		case 2;$phpfile="sucai_pic.php";break;
		case 3;$phpfile="sucai_music.php";break;
		case 4;$phpfile="sucai_video.php";break;
	}

    if ($gotourl==""){$gotourl=url_encode($_SERVER['HTTP_REFERER']);}
?>
	<!--right-->
	<div class="right">
	  
		<div class="xm2">
			<h1 class="fl">编辑素材</h1>
			<!--<span class="fr"><a href="#"><img src="../images/right_4.png" alt="设置" /></a></span>-->
			<div class="clear"></div>
		</div>
		<div class="xm2_b">
		  
			<div class="height15"></div>
				<script type="text/javascript" src="../js/jquerys-1.5.1.js"></script>
				<script language="javascript">
				$(document).ready(function(){ //这个就是传说的ready   
				$(".stripe tr").mouseover(function(){   
				//如果鼠标移到class为stripe的表格的tr上时，执行函数   
				$(this).addClass("over");}).mouseout(function(){   
				//给这行添加class值为over，并且当鼠标一出该行时执行函数   
				$(this).removeClass("over");}) //移除该行的class   
				$(".stripe tr:even").addClass("alt");   
				//给class为stripe的表格的偶数行添加class值为alt
				//www.divcss5.com 整理特效
				});  
				function showimg(fid,fsrc,label){
					document.getElementById(label).value=fid;
					document.getElementById(label+"3").src=fsrc;
					document.getElementById(label+"2").style.display="block";
				}
				function reurl(url,name,size,p){
					document.location=document.location;
				}
				function showtr(trid){
					document.getElementById(trid+"2").style.display="block";
					document.getElementById(trid+"1").style.display="none";
				} 
				function checkform(){
					var fname,mpic,mcontent;
					fname = document.form2.fname.value;
					if(fname==""||fname.length>64){
						alert("标题不能为空且长度不能超过64个字");
						document.form2.fname.focus();
						return false;
					}
					
					return true;
			    }
				var xmlobj; //定义XMLHttpRequest对象
				function CreateXMLHttpRequest()
				{
				if(window.XMLHttpRequest)
				{//Mozilla浏览器
				xmlobj=new XMLHttpRequest();
				if(xmlobj.overrideMimeType)
				{//设置MIME类别
				xmlobj.overrideMimeType("text/xml");
				}
				}
				else if(window.ActiveXObject)
				{ //IE浏览器
				try
				{
				xmlobj=new ActiveXObject("Msxml2.XMLHttp");
				}
				catch(e)
				{
				try
				{
				xmlobj=new ActiveXobject("Microsoft.XMLHttp");
				}
				catch(e)
				{
				}
				}
				}
				
				}
				function delpic(){
					CreateXMLHttpRequest(); 
					fid = document.form2.mpic.value;
					var showurl = "delpic.php?fid="+fid; 
					xmlobj.open("GET", showurl, true);
					xmlobj.onreadystatechange = after_delpic; 
					xmlobj.send(null); 
				}
				function after_delpic() { //用于处理状态的函数
				if(xmlobj.readyState == 4 && xmlobj.status == 200) //如果URL成功访问，则输出网页 
				{	
					ss=xmlobj.responseText;
					if (ss=="1"){
						document.getElementById("mpic").value="";
						document.getElementById("mpic3").src="";
						document.getElementById("mpic2").style.display="none";	
					}else{
						alert("参数错误");
					}
				}
				}
				</script>
				<form id="form2" name="form2" method="post" action="sucai_edit.php?action=saveeidt" onsubmit="return checkform()">
                <input type="hidden" name="id" value="<?php echo $id;?>">
                <input type="hidden" name="phpfile" value="<?php echo $phpfile;?>">
				  <table width="100%" border="0" align="left" cellpadding="9" cellspacing="0">
                    <tr>
                      <td width="143" align="right" class="font14">素材名称：</td>
                      <td colspan="2"><input type="text" name="fname" size="70" value="<?php echo $rsdb["fname"]?>"  maxlength="50"/></td>
                    </tr>
                    <?php if($rsdb["ftype"]==4){?>
                    <tr>
                      <td align="right" class="font14">视频缩略图：</td>
                      <td width="200">
                      <input type='hidden' name='fpic' class="input2" id="mpic" value="<?php echo $rsdb["fpic"]?>">
                      <button type="button" class="button1">上传</button><iframe id="uploadIframe" style="filter:alpha(opacity = 0);-moz-opacity:0;-khtml-opacity:0;opacity:0;overflow:hidden;z-index:99;position:absolute;left:170px;width:93px;height:28px;" class="uploadfile" src="sucai_upload2.php?type=2&formId=1&fn=showimg&dir=sucai&label=mpic"></iframe>
                      </td>
                      <td class="font12">视频缩略图，建议尺寸480像素 * 320像素</td>
                    </tr>
                    
                    <tr>
                      <td align="right" class="font14"></td>
                      <td colspan="2">
                      <div id="mpic2" <?php echo $rsdb["fpic"]==""?'style="display:none;"':"";?>>
                      <img src="<?php echo $rsdb["fpic"];?>" width="100" id="mpic3" />
                      </div>
                      </td>
                    </tr>
                    <?php }?>
                    <tr>
                      <td width="143" align="right" class="font14">素材摘要：</td>
                      <td colspan="2"><textarea name="fintro"  cols="70" rows="10"><?php echo $rsdb["fintro"];?></textarea></td>
                    </tr>
                    
                    
                    
                    <tr>
                      <td>&nbsp;</td>
                      <td class="font14" colspan="2"><input type="submit" class="button" name="button" id="button" value="完成" />&nbsp;&nbsp;
                      <input type="button" class="button2" name="button2" id="button2" value="取消" onclick="window.location='<?php echo $phpfile;?>'" /></td>
                    </tr>
                    <tr>
                      <td colspan="3" height="20">&nbsp;</td>
                    </tr>
                  </table>
          </form>
				<div class="height15"></div>
	  </div>
		<div class="clear"></div>
		<div class="height15"></div>
       
	  </div>
		<div class="clear"></div>
  <?php require("../mx_foot.php") ;?>
  </div>
	<!--right-end-->
</body>
</html>
